package org.android.brasil.projetos.oktoberfest2011.view.controller;

import org.android.brasil.projetos.oktoberfest2011.R;
import org.android.brasil.projetos.oktoberfest2011.utils.AnalyticsUtils;
import org.android.brasil.projetos.oktoberfest2011.utils.ControleDeBackground;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;

public class SobreController extends Activity {
	private AnalyticsUtils mGa;
	
	
	private OnClickListener casaListener = new OnClickListener() {

		public void onClick(View v) {

			setResult(RESULT_OK);
			mGa.buttonTrackEvent("Casa");
			finish();
		}
	};
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		Intent i = new Intent(getApplicationContext(),EasterEgg.class);
		startActivity(i);
	}
	
	protected void onDestroy() {
		super.onDestroy();
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		this.mGa = AnalyticsUtils.getInstance(this);
		
		setContentView(R.layout.sobre_view);
		
		this.mGa.trackScreen("sobre");
		
		ImageView oktober = (ImageView) findViewById(R.idSobre.logo_oktober);
		oktober.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				Uri uri = Uri.parse("http://www.oktoberfestblumenau.com.br/");
				Intent intent = new Intent(Intent.ACTION_VIEW, uri);
				startActivity(intent);

			}
		});
		
		ImageView bannerABP = (ImageView) findViewById(R.idSobre.banner_abp);
		bannerABP.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				Uri uri = Uri.parse("http://www.androidbrasilprojetos.org/");
				Intent intent = new Intent(Intent.ACTION_VIEW, uri);
				startActivityForResult(intent,0);

			}
		});
		
		ImageView logoFree = (ImageView) findViewById(R.idSobre.logo_free);
		logoFree.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				Uri uri = Uri.parse("http://www.free.art.br/");
				Intent intent = new Intent(Intent.ACTION_VIEW, uri);
				startActivity(intent);

			}
		});
		
		ImageView casa = (ImageView) findViewById(R.id.casa);
		casa.setOnClickListener(casaListener);
		
		RelativeLayout rl = (RelativeLayout) findViewById(R.idSobre.relativeLayout01);

		ControleDeBackground.SetBarraSuperiorBackGround(
				getApplicationContext(), rl);



	}
}
